package dao

import (
	"gorm.io/gorm"
	"mall_book/model"
)

type UserDao struct {
	*gorm.DB
}

func NewUserDao(db *gorm.DB) *UserDao {
	return &UserDao{DB: db}
}

func (dao *UserDao) FindAll() ([]*model.User, error) {
	var res []*model.User
	err := dao.DB.Model(&model.User{}).Find(&res).Error
	return res, err
}
